package com.kingstar.ceres.data;

import com.kingstar.ceres.data.properties.ConnectionConfigWrapper;
import com.kingstar.ceres.data.remote.ConnectionFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfigureBefore(CsvImportAutoConfigure.class)
@EnableConfigurationProperties(ConnectionConfigWrapper.class)
public class ConnectionFactoryAutoConfigure {

    @Bean(initMethod = "init")
    @ConditionalOnMissingBean
    public ConnectionFactory connectionFactory(){
        return new ConnectionFactory();
    }
}
